package co.com.inventarios.logica;

import java.util.List;

import co.com.inventarios.modelo.Mngcco;
import co.com.inventarios.modelo.Mngdoc;
import co.com.inventarios.modelo.Mngmcnsn;
import co.com.inventarios.modelo.MngmcnsnId;
import co.com.inventarios.modelo.Proserie;
import co.com.inventarios.persistencia.EntityManagerHelper;
import co.com.inventarios.persistencia.IMngmcnsnDAO;
import co.com.inventarios.persistencia.IUnimedDAO;
import co.com.inventarios.persistencia.MngmcnsnDAO;
import co.com.inventarios.persistencia.QueryMngmcnsnDAO;
import co.com.inventarios.persistencia.UnimedDAO;

public class MngmcnsnLogica implements IMngmcnsnLogica {

	IMngmcnsnDAO lDAO = new MngmcnsnDAO();
	private Mngmcnsn MiMngmcnsn_cons;
	private List<Proserie> MiPrserie_cons;
	private IProserieLogica logicaProserie;
	
	public Mngmcnsn getMiMngmcnsn_cons() {
		return MiMngmcnsn_cons;
	}

	public List<Proserie> getMiPrserie_cons() {
		return MiPrserie_cons;
	}

	public void setMiPrserie_cons(List<Proserie> miPrserie_cons) {
		MiPrserie_cons = miPrserie_cons;
	}

	public IProserieLogica getLogicaProserie() {
		return logicaProserie;
	}

	public void setLogicaProserie(IProserieLogica logicaProserie) {
		this.logicaProserie = logicaProserie;
	}

	public void setMiMngmcnsn_cons(Mngmcnsn miMngmcnsn_cons) {
		MiMngmcnsn_cons = miMngmcnsn_cons;
	}

	public List<Mngmcnsn> buscarTodosMngmcnsn() throws Exception {
		return new MngmcnsnDAO().findAll();
		// TODO Auto-generated method stub
	}

	public void GuardarMngmcnsn(Mngmcnsn reg) throws Exception {
		try {
			EntityManagerHelper.getEntityManager().getTransaction().begin();
			lDAO.save(reg);
			EntityManagerHelper.getEntityManager().getTransaction().commit();
		} catch (Exception ex) {
			ex.printStackTrace();
			EntityManagerHelper.getEntityManager().getTransaction().rollback();
		}
	}

	public void EliminarMngmcnsn(Mngmcnsn reg) throws Exception {
		try {
			EntityManagerHelper.getEntityManager().getTransaction().begin();
			lDAO.delete(reg);
			EntityManagerHelper.getEntityManager().getTransaction().commit();
		} catch (Exception ex) {
			ex.printStackTrace();
			EntityManagerHelper.getEntityManager().getTransaction().rollback();
		}
	}

	public List<Mngmcnsn> findByPropertyAll(String propertyName, Object value,
			String espresion) throws Exception {
		return new QueryMngmcnsnDAO().findByPropertyAll(propertyName, value,
				espresion);
		// TODO Auto-generated method stub
	}

	public List<Mngmcnsn> findBy_all(String propertyName) throws Exception {
		return new QueryMngmcnsnDAO().findBy_all(propertyName);
		// TODO Auto-generated method stub
	}

	public Mngmcnsn findByProperty(String propertyName) throws Exception {
		return new QueryMngmcnsnDAO().findByProperty(propertyName);
		// TODO Auto-generated method stub
	}

	public Mngmcnsn findByPropertyActivo(String propertyName, Object value)
			throws Exception {
		return new QueryMngmcnsnDAO().findByPropertyActivo(propertyName, value);
		// TODO Auto-generated method stub
	}

	public List<Mngmcnsn> findByPropertyActivoLista(String propertyName)
			throws Exception {
		return new QueryMngmcnsnDAO().findByPropertyActivoLista(propertyName);
		// TODO Auto-generated method stub
	}

}
